package com.strawberry.chat2.views.neteasePlayer;

import android.graphics.Bitmap;
import android.support.annotation.Nullable;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;

import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.common.MapBuilder;
import com.facebook.react.uimanager.SimpleViewManager;
import com.facebook.react.uimanager.ThemedReactContext;
import com.facebook.react.uimanager.annotations.ReactProp;
import com.facebook.react.uimanager.events.RCTEventEmitter;

import java.util.Map;

public class neteasePlayerManager extends SimpleViewManager<neteasePlayerView> {
    private static final String GIFVIEW_MANAGER_NAME = "NeteasePlayer";

    private static final String PROP_SRC = "src";
    private static final String PROP_DESTORY = "destory";

    @Override
    public String getName() {
        return GIFVIEW_MANAGER_NAME;
    }

    @Override
    protected neteasePlayerView createViewInstance(ThemedReactContext reactContext) {
        final neteasePlayerView videoView = new neteasePlayerView(reactContext);
        return videoView;
    }

    @ReactProp(name = PROP_SRC)
    public void setSrc(final neteasePlayerView videoView, String url) {
        videoView.setSrc(url);
    }

    @ReactProp(name = PROP_DESTORY)
    public void setDestory(final  neteasePlayerView videoView, Boolean destory_flg){
        if(destory_flg) {
            videoView.releaselayer();
        }
    }
}
